using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;

namespace H5Engine
{
    /// <summary>
    /// 一维曲线抽象类
    /// </summary>
    public class LogCurve1D:LogCurve
    {


        public LogCurve1D()
        {
        }


        /// <summary>
        /// 取数据
        /// </summary>
        /// <param name="depth"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        public float[] ReadData(double depth, int count)
        {
  
            int index = GetDepthIndex(depth);
            if(index< 0) 
            {
                return null;
            }

            #region values
            //for beginners
            // following code is ok
            float[] vals = new float[Math.Min(Datas.Count-index, count)];
            //
            for (int i = 0; i < vals.Length; i++)
            {
                vals[i] = Datas[i+index];
            }   
            #endregion
            /*
             furthmore call Api
             this is recommendation!!! 
            */
            //Array.Copy(Datas.ToArray(), index, vals, 0, length);
            //advacned, use LINQ
            
                     
            return vals;
        }


        /// <summary>
        /// 变量
        /// 存储等间隔曲线数值
        /// </summary>
        /// <typeparam name="float"></typeparam>
        /// <returns></returns>
        public List<float> Datas {get; private set;} = new List<float>();
   
    }


}